package com.lefevre.cms.bean.staff;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 员工登录日志
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("staff_login_log")
@Entity
@Table(name = "staff_login_log", indexes = {@Index(name = "staffLoginLog_idx", columnList = "staffId,logonTime")})
public class StaffLoginLog implements Serializable {
    private static final long serialVersionUID = -6929531301029127372L;

    @Id
    @Column(length = 50)
    @TableId(type = IdType.INPUT)
    protected String id;

    /**
     * 员工Id
     **/
    @Column(length = 36)
    protected String staffId;

    /**
     * 登录时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    protected Date logonTime = new Date();

    /**
     * 登录IP
     **/
    @Column(length = 45)
    protected String ip;

    /**
     * IP归属地
     **/
    @Transient
    @TableField(exist = false)
    protected String ipAddress;

}
